package org.dreamwork.jasmine2.restful;

import com.google.gson.annotations.Expose;

/**
 * Created with IntelliJ IDEA.
 * User: seth.yang
 * Date: 14-11-18
 * Time: 下午2:01
 */
public class ContextParameterDefinition {
    @Expose
    String name;
    @Expose
    boolean required;
    @Expose
    String description;
    @Expose
    String typeName;

    Class<?> type;

    public static final ContextParameterDefinition APPLICATION_ID =
            new ContextParameterDefinition ("appId", true);
    static {
        APPLICATION_ID.type = String.class;
        APPLICATION_ID.typeName = APPLICATION_ID.type.getCanonicalName ();
        APPLICATION_ID.description = "接入的应用程序ID";
    }

    public ContextParameterDefinition () {
    }

    public ContextParameterDefinition (String name, boolean required) {
        this.name = name;
        this.required = required;
    }

    public String getName () {
        return name;
    }

    void setName (String name) {
        this.name = name;
    }

    public boolean isRequired () {
        return required;
    }

    void setRequired (boolean required) {
        this.required = required;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass () != o.getClass ()) return false;

        ContextParameterDefinition that = (ContextParameterDefinition) o;

        return name != null && name.equals (that.name);
    }

    @Override
    public int hashCode () {
        return name == null ? 0 : name.hashCode ();
    }

    public String getDescription () {
        return description;
    }

    public void setDescription (String description) {
        this.description = description;
    }

    public String getTypeName () {
        return typeName;
    }

    void setTypeName (String typeName) {
        this.typeName = typeName;
    }

    public Class<?> getType () {
        return type;
    }

    void setType (Class<?> type) {
        this.type = type;
    }
}